package com.jike.noobmoney.adapter;


import android.content.Context;
import android.widget.ImageView;

import com.jike.noobmoney.R;
import com.jike.noobmoney.contants.ConstantValue;
import com.jike.noobmoney.entity.GoldPromotionEntity;
import com.jike.noobmoney.helper.ImageLoader;


/**
 * Created by kekex on 2018/9/8.
 * top发布者列表adapter
 */

public class TopInviteAdapter extends BaseRecyclerAdapter<GoldPromotionEntity.InviteweekrankBean> {


    private Context context;

    public TopInviteAdapter(Context context) {
        super(R.layout.item_top_invite);
        this.context = context;
    }

    @Override
    protected void onBindViewHolder(SmartViewHolder holder, GoldPromotionEntity.InviteweekrankBean item, int position) {
        holder.text(R.id.tv_paihang, String.format("%s", position + 1));
        holder.text(R.id.tv_tuijianma, "" + item.getU_id());
        holder.text(R.id.tv_renshu, "" + item.getInvitenumber());

        holder.text(R.id.tv_yujiang, String.format("预奖%s元", item.getMoney()));

        ImageView photo = (ImageView) holder.findViewById(R.id.iv_user_photo);
        if (item.getAvatar() != null) {
            String url = ConstantValue.IMG_BASEURL + item.getAvatar();
            ImageLoader.displayImageDefaultHead(context, url, photo);
        } else {
            ImageLoader.displayImageDefaultHead(context, R.drawable.ic_user_default, photo);
        }

    }
}
